<template>
    <uni-popup ref="popup" type="center" :mask-click="false" background-color="transparent">
        <view class="popup_box">

            <image class="bg" src="/static/bg6.jpg"></image>

            <view style="height:142rpx;" class="d-flex d-r j-center">
                <image class="dun" src="/static/dun.png" mode="" />
            </view>

            <view class="title d-flex d-r j-center"><text class="text">温馨提示</text></view>
            <view class="desp">
                <text class="text">为了保护您的个人信息安全:</text>


                <view class="d-flex d-r j-center">
                    <text
                        class="u_line"
                        @tap="goUserAgreement"
                        >《用户协议》</text
                    >
                    <text class="text">和</text>
                    <text class="u_line" @tap="goPrivacyPolicy">《隐私协议》</text>

                </view>

                <text class="text">
                    告知我们如何手机个人信息 如和使用及存储个人信息，及您享有的相关
                权力，点击“同意”相关协议条款，“不同意”将退出App。
                </text>


            </view>
            <view
                class="btn_main_r"
                style="width: 480rpx; margin-top: 50rpx;margin-left:0;"
                @tap="agree"
            >
                <text class="text" style="color:#fff;">同意</text>
            </view>

            <!-- <view
                class="btn_main_r_line"
                style="width: 480rpx; margin-top: 20rpx;margin-left:0;"
                @tap="exit"
            >
                <text class="text">不同意并且退出</text>
            </view> -->
        </view>
    </uni-popup>
</template>

<script setup lang="ts">
import { ref,computed } from "vue";
import { config as configStore } from "@/store/config";
import { ver } from "@/store/ver";
const VER = ver();
const emit = defineEmits(["agree"]);
const config: any = configStore();

const goUserAgreement = ()=>{
    uni.navigateTo({
		url:`/pages/webview/webview?title=用户协议&url=http://52pp365.com/yonghuxieyi.html`
	});
}

const goPrivacyPolicy = ()=>{
    uni.navigateTo({
		url:`/pages/webview/webview?title=隐私政策&url=http://52pp365.com/yinsizhengce.html`
	});
}

const popup = ref(null);


const open = ()=>{
    if(VER.ver){
        popup.value.open();
    }

}

const agree = ()=>{
    const pages = getCurrentPages();
    const currenturl = pages[pages.length - 1].route;
    uni.setStorageSync(`noticereaded-${currenturl}`,2)
    config.setConfig({agreement:true});
    popup.value.close();

}

const exit = ()=>{
    if(uni.getSystemInfoSync().platform==='ios'){
        plus.ios.import("UIApplication").sharedApplication().performSelector("exit");
    }
    if(uni.getSystemInfoSync().platform==='android'){
        plus.runtime.quit();
    }
}


defineExpose({
  open,
})


</script>
<style lang="scss" scoped>
.a-center {
    align-items: center;
}

.j-center {
    justify-content: center;
}

.j-between {
    justify-content: space-between;
}

.j-around {
    justify-content: space-around;
}

.d-flex {
    display: flex;
}

.d-c {
    flex-direction: column;
}
.d-r {
    flex-direction: row;
}

.j-end {
    justify-content: flex-end;
}


.popup_box{
    position:relative;
    width:584rpx;
    height:650rpx;
    padding:45rpx;
    border-radius: 20rpx;
    .bg{
        position:absolute;
        width:584rpx;
        height:650rpx;
        top:0;
        left:0;

    }
    .u_line{
        text-decoration: underline;
        color:#1DC691;
    }
    .dun{
        width:100rpx;
        height:142rpx;
        margin:0 auto;
    }

    .title{
        margin-top:-10rpx;
        .text{
            color:#333;
            font-size:34rpx;
        }
    }

    .desp{
        text-align: left;
        margin-top:20rpx;
        .text{
            font-size:26rpx;
            color:#585859;
        }
    }



}
</style>

